from building import *
import os  # 需要导入os模块进行目录操作

cwd = GetCurrentDir()

# 获取当前目录下的所有子项:cite[1]
lists = os.listdir(cwd)

# 您原有的当前目录编译配置
src = Glob('*.c') + Glob('*.cpp')
CPPPATH = [cwd]

group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)

# 递归处理子目录
for item in lists:
    item_path = os.path.join(cwd, item)
    # 确保目录包含SConcript文件
    if os.path.isdir(item_path) and os.path.isfile(os.path.join(item_path, 'SConscript')):
        sub_group = SConscript(os.path.join(item, 'SConscript'))
        if sub_group:
            group = group + sub_group

# 返回当前目录的组和所有子目录的组:cite[1]
Return('group')